clc;clear all;close all
R=47;
C=33e-12;
tau=R*C;
T=tau/300;
t=0:T:(10*tau);
N=length(t);
w=1e9;
Uvh(1)=sin(T*w);

stdn=3;

%АЧХ%
w=2*pi*((1/tau/100):(1/tau/100):(1/tau/2));
M=length(w);
for l=1:M
    for k=2:N;
        if t(k)<0
            Uvh(k)=0;
        else
            Uvh(k)=sin(k*T*w(l));
        end;
        Uvih(k)=Uvh(k)/2;
    end;
    K(l)=Uvih/Uvh;
end
figure(1)
plot(w/2/pi,K)
ylim([0,1])
xlabel('f,Hz')
ylabel('K')
grid on


%На входе гармоническое воздействие%
for k=2:N;
    if t(k)<0
        Uvh(k)=0
    else
        Uvh(k)=sin(k*T*w(50));
    end;        
  Uvih(k)=Uvh(k)/2;
end;
figure(2)
plot(t,Uvh,t,Uvih)
xlabel('t')
ylabel('Uvh,Uvih')
grid on


%На входе функция Хевисайд
for k=2:N;
    if t(k)<0
        Uvhh(k)=0
    else
        Uvhh(k)=1;
    end;        
  Uvihh(k)=Uvhh(k)/2;
end;
figure(3)
plot(t,Uvhh,t,Uvihh)
xlabel('t,')
ylabel('Uvhh,Uvihh')
grid on


%На входе шум%
for k=2:N;
    Uvhw(k)=randn(1,1)*stdn;
    Uvihw(k)=Uvhw(k)/2;
end;
figure(4)
plot(t,Uvhw,t,Uvihw)
xlabel('t')
ylabel('Uvhw,Uvihw')
grid on




